//package com.wangyadong.hobby.thread;
//
//import io.netty.util.internal.ConcurrentSet;
//
//import java.util.List;
//import java.util.Set;
//import java.util.concurrent.CompletionService;
//import java.util.concurrent.CopyOnWriteArrayList;
//import java.util.concurrent.ExecutorCompletionService;
//import java.util.stream.IntStream;
//
//public class Test {
//
//    public static void main(String[] args) throws InterruptedException {
//
////        GoodListHelper badListHelper = new GoodListHelper();
////        BadListHelper badListHelper = new BadListHelper();
////
////        Set set = new ConcurrentSet();
////        IntStream.range(0, 10000).forEach(i -> {
////            new Thread(() -> {
////                if (i % 2 == 0) {
////                    set.add(badListHelper.putIfAbsent(i));
////                } else {
////                    List list = badListHelper.list;
////                    list.remove(i);
////                }
////
////            }).start();
////
////        });
////        Thread.sleep(5_000);
////        System.out.println("-->" + set.size());
//
////        CopyOnWriteArrayList list = new CopyOnWriteArrayList();
////        IntStream.range(0, 1000).forEach(i -> {
////            list.add(i);
////        });
////        final int size = list.size();
////        new Thread(() -> {
////            try {
////                Thread.sleep(5);
////                for (int i = size; i > size; i--) {
////                    System.out.println(list.get(i));
////                }
////            } catch (Exception e) {
////                e.printStackTrace();
////            }
////
////        }).start();
////
////        new Thread(() -> {
////            try {
////                for (int i = 0; i < size; i++) {
////                    list.remove(i);
////                }
////            } catch (Exception e) {
////                e.printStackTrace();
////            }
////
////        }).start();
//
//////
//
//        Thread t1 = new Thread(() -> {
//            try {
//                System.out.println("=====");
//                Thread.sleep(2000);
//                System.out.println("----");
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//                Thread.currentThread().isInterrupted();
//                Thread.interrupted();
//                Thread.currentThread().interrupt();
//            }
//        }, "caller");
//
//        t1.start();
//        t1.interrupt();
//
////        new Thread(() -> {
////
////        }, "back_caller").start();
////        ExecutorCompletionService service=new ExecutorCompletionService();
//    }
//}
